﻿namespace PayPal.AdaptivePayments
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    using PayPal;
    using PayPal.Platform.SDK;

    public static class ValidationHelper
    {
        public static void ValidateAccountEmail(string accountEmail)
        {
            if (accountEmail == null)
            {
                throw new ArgumentNullException("accountEmail");
            }
        }
                
        public static void ValidatePrimaryReceiver(Receiver receiver)
        {
            if (receiver == null)
            {
                throw new ArgumentNullException("receiver");
            }
        }

        public static void ValidateSecondaryReceiver(List<Receiver> receivers)
        {
            if (receivers == null)
            {
                throw new ArgumentNullException("receivers");
            }
        }        
        
        public static void ValidateUrl(string returnUrl, string cancelUrl)
        {
            if (string.IsNullOrEmpty(returnUrl))
            {
                throw new ArgumentNullException("returnUrl");
            }

            if (string.IsNullOrEmpty(cancelUrl))
            {
                throw new ArgumentNullException("cancelUrl");
            }
        }

        public static void ValidateCurrencyCode(string currencyCode)
        {
            if (string.IsNullOrEmpty(currencyCode))
            {
                throw new ArgumentNullException("currencyCode");
            }
        }
        
        public static void ValidateProfile(BaseAPIProfile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }
        }

        public static void ValidateLanguage(string language)
        {
            if (string.IsNullOrEmpty(language))
            {
                throw new ArgumentNullException("language");
            }
        }

        public static void ValidateBaseInput(string memo, string userIp, string deviceId)
        {
            if (memo == null)
            {
                throw new ArgumentNullException("memo");
            }

            if (userIp == null)
            {
                throw new ArgumentNullException("userIp");
            }

            if (deviceId == null)
            {
                throw new ArgumentNullException("deviceId");
            }
        }
    }
}
